// var total = [1,2,3,4].reduce((acc,cur,index,o)=>{
//     console.log(acc,cur,index,o)
//     return acc + cur
// },10)
// console.log(total);

var bills = [
    {
        type:'shop',
        money:513
    },
    {
        type:'study',
        money:545
    },
    {
        type:'shop',
        money:4697
    },
    {
        type:'transfer',
        money:3241
    },
    {
        type:'shop',
        money:655
    },
    {
        type:'transfer',
        money:984
    }
]
console.log(bills.reduce((acc,bill) => {
    if(!acc[bill.type]) {
        acc[bill.type] = [];
    }
    acc[bill.type].push(bill)
    return acc
},{}))